/*
{
"状态":1,
"名称":"修改-供应商资料",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"修改-供应商资料",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/
declare @supplier_id int ,@supplier_no varchar(100), @supplier_name varchar(100), @phone varchar(100),@contacter varchar(100),@sup_address varchar(100),@landline varchar(100)
declare @short_name varchar(100),@fax varchar(100)

set @supplier_id = '{supplier_id}'
set @supplier_no = '{supplier_no}'
set @supplier_name ='{supplier_name}'
set @short_name ='{short_name}'
set @fax ='{fax}'
set @phone ='{phone}'
set @contacter ='{contacter}'
set @sup_address ='{sup_address}'
set @landline ='{landline}'

 
--校验信息
if isnull(@supplier_no,'')=''
begin 
	RAISERROR ('SQL:供应商编号不允许为空', 16 ,1 ) ; 
	return 
end 

if isnull(@supplier_name,'')=''
begin 
	RAISERROR ('SQL:供应商名称不允许为空', 16 ,1 ) ; 
	return 
end 

if EXISTS(SELECT * FROM b_supplier WHERE [supplier_id] <> @supplier_id and [supplier_no]=@supplier_no )
begin
	RAISERROR ('SQL:供应商编号已经存在', 16 ,1 ) ; 
	return 
end


update [dbo].[b_supplier] set
[supplier_no] = @supplier_no ,
[supplier_name] = @supplier_name ,
[short_name] = @short_name ,
[simple_code] = dbo.f_getpy(@short_name),
[fax] = @fax ,
[phone] = @phone ,
[contacter] =  @contacter,
[sup_address] = @sup_address,
[landline] = @landline ,
[update_time] = getdate(),  
[update_user] = 0
where [supplier_id] = @supplier_id




